package com.mzwise.tunnel.utils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtils {
    public static String getNow(String formatBy) {
        Date date = new Date();
        DateFormat format = new SimpleDateFormat(formatBy);
        String day = format.format(date);
        return day;
    }

    public static String getNow() {
        return getNow("yyyy-MM-dd HH:mm:ss");
    }

    public static String getAfterYearNow(Integer year) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.YEAR,year);
        Date date = calendar.getTime();
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String day = format.format(date);
        return day;
    }
}
